home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / windows / cm95_10.zip / INTERNET.DLL / TEXT / WILNETSCAPE < prev    next >
Text File  |  1996-10-29  |  3KB  |  135 lines

  1. AddExtender ("WXSock32i.dll")
  2. IntControl (35, 500, 0, 0, 0)
  3. bOK = @TRUE
  4. sDial     = "<dialupname>"
  5. nMaxRedial = <numredials>
  6. nRedialDelay = 10
  7. sPgmPath  = "<pgmpath>"
  8. sPgmDir   = "<pgmdir>"
  9. bSendMail  = <sendmail>
  10. bEmpty     = <empty>
  11. sErrDesc  = ""
  12. nWait      = 5 ; How many minutes to wait for Netscape to finish its work
  13.  
  14.  
  15. ;Dial our host (unless user is on a direct connect)...
  16. hConn = 0
  17. nNumRedials = 0
  18. if (sDial <> "")
  19.     :DialIt
  20.     hConn = DUNConnect (sDial)
  21.     nErr = SGetLastErr ()
  22.     if (!hConn)
  23.         switch nErr
  24.         case @SErrNotFound
  25.             sErrDesc = "Couldn't connect to %sDial%: no such dial-up"
  26.             break
  27.         case @SErrBusy
  28.             if (nNumRedials <= nMaxRedial)
  29.                 nNumRedials = nNumRedials + 1
  30.                 Delay (nRedialDelay)
  31.                 goto DialIt
  32.             else
  33.                 sErrDesc = "Couldn't connect to %sDial%: Line busy"
  34.             endif
  35.             break
  36.         case @SErrNoAnswer
  37.             if (nNumRedials <= nMaxRedial)
  38.                 nNumRedials = nNumRedials + 1
  39.                 Delay (nRedialDelay)
  40.                 goto DialIt
  41.             else
  42.                 sErrDesc = "Couldn't connect to %sDial%: No answer"
  43.             endif
  44.             break
  45.         case @SErrVoice
  46.             sErrDesc = "Couldn't connect to %sDial%: A human answered"
  47.             break
  48.         case nErr ; <--default
  49.             sErrDesc = "Couldn't connect to %sDial% - error %nErr%"
  50.         endswitch
  51.         bOK = @FALSE
  52.         goto LogIt
  53.     else
  54.         if (nErr == @SAlready)
  55.             ; We're already connected. Don't hang up when this event is thru...
  56.             hConn = 0 
  57.         endif
  58.     endif
  59. endif
  60.  
  61.  
  62. ; Run Netscape & make it do things...
  63. sTitle = "Netscape"
  64. if (WinExist (sTitle))
  65.     WinActivate (sTitle)
  66. else
  67.     DirChange (sPgmDir)
  68.     Run (sPgmPath, "")
  69.     delay (2)
  70. endif
  71.  
  72.  
  73. ; Bring up the Mail window (which automatically gets new mail too)...
  74. SendKeysTo (sTitle, "!wm")
  75. Delay (10)
  76.  
  77.  
  78. if (WinExistChild(sTitle, "No new messages"))
  79.     SendKey ("~")
  80. endif
  81.  
  82. if (WinExist("Password Entry Dialog"))
  83.     WinClose ("Password Entry Dialog")
  84. endif
  85.  
  86.  
  87. ; Send outgoing mail/articles (if chosen)...
  88. if (bSendMail)
  89.     if (WinExist (sTitle))
  90.         SendKeysTo (sTitle, "!fd")
  91.     endif
  92. endif
  93.  
  94.  
  95. ; Wait for nWait minutes, or till user kills off Netscape manually...
  96. for n=1 to nWait * 6
  97.     if (WinExist (sTitle))
  98.         Delay (10)
  99.         MouseMove (100+n, 100, "", "")
  100.     endif
  101. next n
  102.  
  103.  
  104. ; If user hit Ctrl+Break, WIL will bring us here...
  105. :Cancel
  106.  
  107. ; Hang up...
  108. :HangUp
  109. if (hConn)
  110.     nRet = DUNDisconnect (hConn)
  111. endif
  112.  
  113.  
  114. ; Empty the trash (if chosen)...
  115. if (bEmpty)
  116.     if (WinExist (sTitle))
  117.         SendKeysTo (sTitle, "!fe")
  118.     endif
  119. endif
  120.  
  121.  
  122. ; Log what we did...
  123. :LogIt
  124. if bOK == @TRUE
  125.     sLog = "Ran Netscape"
  126. else
  127.     sLog = strcat ("Error attempting to automate Netscape:", @CRLF, sErrDesc)
  128. endif
  129.  
  130. CMLogMessage (sLog)
  131. Display (8, "ClockMan95", sLog)
  132. exit
  133.  
  134. ~
  135.